center layout: Fix handling of expanding center child
authorMatthias Clasen <mclasen@redhat.com>
Fri, 1 Jan 2021 16:02:57 +0000 (11:02 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 1 Jan 2021 16:02:57 +0000 (11:02 -0500)
We were not taking spacing into account when adjusting
the size of an expanding center child, causing it to slip
under the end child at times.

Fixes: #3506
gtk/gtkcenterlayout.c

index f9fa988ca7ef7ab47150dcec2d599b642af4e12e..b2dee1db0d11a2c8cb5f258365275c7a87b5c046 100644 (file)
@@ -177,7 +177,7 @@ gtk_center_layout_distribute (GtkCenterLayout  *self,
         center_pos = size - center_size - end_size - spacing;
       else if (center_expand)
         {
-          center_size = size - 2 * MAX (start_size, end_size);
+          center_size = size - 2 * (MAX (start_size, end_size) + spacing);
           center_pos = (size / 2) - (center_size / 2) + spacing;
         }